package com.mew.slots.core.game.mjk.room;

import com.mew.slots.core.common.game.BaseRoom;
import com.mew.slots.core.game.mjk.bo.MjkPlayMsgs;
import com.mew.slots.core.game.mjk.roller.Controlline;

import java.util.ArrayList;
public class MjkRoom extends BaseRoom {

    final int _FREE = 10;
    final int _SCATTER = 11;
    final int _BONUS = 12;
    public MjkRoom(){
        res = new MjkPlayMsgs();
        row = 3;
        col = 5;
        _WILD = 13;
        spes = new ArrayList<Integer>(){{
            add(_FREE);
            add(_SCATTER);
            add(_BONUS);
        }};
        rate = new int[][]{
                {0, 0,  5, 10, 50},      //方块          0
                {0, 0,  5, 10, 50},      //梅花           1
                {0, 0,  5, 10, 50},      //红桃           2
                {0, 0,  5, 10, 50},      //黑桃           3
                {0, 0,  5, 10, 50},      //仙人掌          4

                {0, 0, 10, 20, 100},      //红毛猫          5
                {0, 0, 25, 50, 250},      //黄毛猫          6
                {0, 0, 40, 80, 400},      //灰猫            7
                {0, 0, 50,100, 500},      //黑猫            8
                {0, 0,100,200,1000},      //傻逼帽子猫       9

                {0, 0,  0,   0,  0},      //FREE            10
                {0, 0,  0,   0,  0},      //SCATTER 蛋      11
                {0, 0,  0,   0,  0},      //BONUS 帽子       12
                {0, 0,  0,   0,  0},      //WILD            13
        };
        alllines=new int[][]{
                {5,6,7,8,9},
                {0,1,2,3,4},
                {10,11,12,13,14},
                {0,6,12,8,4},
                {10,6,2,8,14},
                {5,1,7,13,9},
                {5,11,7,3,9},
                {0,1,7,13,14},
                {10,11,7,3,4},
                {0,6,2,8,4},
                {10,6,12,8,14},
                {5,1,2,3,9},
                {5,11,12,13,9},
                {0,6,7,8,4},
                {10,6,7,8,14},
                {5,6,2,8,9},
                {5,6,12,8,9},
                {5,1,7,3,9},
                {5,11,7,13,9},
                {0,1,2,8,14},
                {10,11,12,8,4},
                {0,6,12,13,14},
                {10,6,2,3,4},
                {5,6,7,3,14},
                {5,6,7,13,4},
                {0,6,7,8,14},
                {10,6,7,8,4},
                {10,11,7,3,9},
                {0,1,7,13,9},
                {10,6,12,13,14},
                {0,6,2,3,4},
                {0,6,12,8,9},
                {10,6,2,8,9},
                {5,1,7,3,4},
                {5,11,7,13,14},
                {0,6,7,8,9},
                {10,6,7,8,9},
                {5,1,2,3,4},
                {5,11,12,13,14},
                {5,6,7,8,4},
                {5,6,7,8,14},
                {0,1,7,3,4},
                {10,11,7,13,14},
                {0,1,2,8,4},
                {10,11,12,8,14},
                {5,6,2,3,4},
                {5,6,12,13,14},
                {0,1,7,8,4},
                {10,11,7,8,14},
                {10,6,2,8,4}
        };
    }

    @Override
    public void freeBouns(){
        MjkPlayMsgs pmres= (MjkPlayMsgs) res;
        int scatterNum = fsdb(_SCATTER);
        if(scatterNum>2){
            pmres.setBonusType(1);
            pmres.setBouns(5);
        }
        int bonusNum= fsdb(_BONUS);
        if(bonusNum>2){
            pmres.setBonusType(2);
            pmres.setBouns(1);
        }
        int freeNum= fsdb(_FREE);
        if(freeNum>=5){
            pmres.setFree((byte) 1);
            pmres.setFreeNumber(8);
        }
    }
    @Override
    public int[] control(){
        Controlline controlline=new Controlline();
        switch (controlType) {
            case 1:
                return bigwin();
            case 2:
                return controlline.free();
            case 3:
                return controlline.bonus();
            case 4:
                return controlline.jp();
            default:
                return controlline.empty();
        }
    }
}
